package com.thoughtworks.biblioteca.dao.stub;

import com.thoughtworks.biblioteca.model.Book;
import com.thoughtworks.biblioteca.dao.BookDao;

import java.util.List;
import java.util.ArrayList;

public class BookDaoStub implements BookDao {

    public List<Book> getAllBooks() {
        List<Book> books = new ArrayList<Book>();

        books.add(new Book(1, "Sweet Valley High vol. 4", "John Travolta"));
        books.add(new Book(2, "eXtreme Programming Explained", "Kent Beck"));

        return books;
    }

    public boolean isExsitingBook(int bookID) {
        boolean isExsitMovie = false;

        List<Book> books = getAllBooks();

        for (Book book : books) {
            if (bookID == book.getId()) {
                isExsitMovie = true;
                break;
            }
        }

        return isExsitMovie;
    }
}
